//Lindsay Ergenekan 
//ergenekl@onid.oregonstate.edu
//CS311-400
//Homework3 
//


#include <stdio.h> 
#include <getopt.h> 
#include <sys/utsname.h> 
#include <time.h> 
#include <sys/stat.h>
#include <stdlib.h>

int main(int argc, char **argv)
{ 
char c; 
struct stat s; 
int lflag=0;
int off1flag = 0; 
int off2flag = 0;
int fflag = 0;
int err = 0;
int length = 0;
int offset1 = 0;
int offset2 = 0;
char *file_name;

while ((c = getopt(argc, argv, "f:o:O:l:v")) != -1)
    switch (c){ 
    case 'l': 
	lflag = 1;
        length = atoi(optarg);
        printf(" legnth: %d    ", length); 
        break;	
    case 'o': 
        off1flag = 1;
        offset1 = atoi(optarg);
        printf(" offset1: %d", offset1);
        break;
    case 'O':
        off2flag = 1;
        offset2 = atoi(optarg);
        printf(" offset2: %d", offset2);
        break;
    case 'f':
        fflag = 1;
//        file_name = *optarg; 
       if (stat(optarg, &s) == 0) 
       { 
       file_name = optarg; 
       printf("size of file '%s' is %d bytes\n" , optarg, (int) s.st_size); 


       printf("size of file '%s' \n" , file_name); 

       } 
       else { 
      printf("file '%s' not found\n", optarg); 
       }
       break;
    case '?': 
        err = 1;
        printf ("Error is: %d", err);
        break;
    }

if (off2flag == 1)
    {


     }

if (off1flag ==1)
     {
     


     }

if (fflag == 1)
  {
  

  }

return 1;
}
